﻿using System.Collections;
using System.Collections.Generic;
using INTEX.DataBase.Tools;
using ReflectionStudio.Core;
using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.IO;
using WPFExcelReport.Helpers;
namespace WPFExcelReport
{
   
    public partial class ITXEXRPT
    {
        public string YGRPrint(ref bool IsReturn)
        {
            if (app.company != "YGR")
                return filename;
            Helper.GetDate(ref date, ref year, ref month, ref day);
            switch (DocType)
            {

                #region======YGRAB==============
                case "YGRHRPDCXS"://作业统计
                    destfolder = SetFolder(Root, "作业统计");
                    #region====文件命名==============
                    order = date;
                    DestFile = destfolder + "\\作业统计" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRHRPDCXS";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRHRPDCXS(dsSource);
                    break;
                case "YGRAB50AR":
                    destfolder = SetFolder(Root, "配方单");
                    #region====文件命名==============
                    if (!dsSource.Tables.Contains("ABKOPF"))
                        IsReturn = true;
                    dwOrder = dsSource.Tables["ABKOPF"].Rows[0];
                    if (dwOrder == null)
                    {
                        IsReturn = true;
                    }
                    KRS = dwOrder["ABKAUFKRS"].ToString().Trim();
                    LFD = dwOrder["ABKAUFLFD"].ToString().Trim();
                    order = KRS + Helper.GetSubRollNum(LFD);
                    DestFile = destfolder + "\\AR" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRAB50AR";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRAB50AR();
                    break;
                case "YGRAB50DOC":
                    destfolder = SetFolder(Root, "生产单");
                    #region====文件命名==============
                    if (!dsSource.Tables.Contains("ABPOS"))
                        IsReturn = true;
                    dwOrder = dsSource.Tables["ABPOS"].Rows[0];
                    if (dwOrder == null)
                    {
                        IsReturn = true;
                    }
                    KRS = dwOrder["ABPAUFKRS"].ToString().Trim();
                    LFD = dwOrder["ABPAUFLFD"].ToString().Trim();
                    POS = dwOrder["ABPAUFPOS"].ToString().Trim();
                    order = KRS + "-" + Helper.GetSubRollNum(LFD) + "-" + Helper.GetSubRollNum(POS);
                    DestFile = destfolder + "\\生产单" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRAB50DOC";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRAB50DOC(dsSource);
                    break;
                case "YGRABFBWC":
                    destfolder = SetFolder(Root, "复板单完成");
                    #region====文件命名==============
                    if (!dsSource.Tables.Contains("ABPOS"))
                        IsReturn = true;
                    dwOrder = dsSource.Tables["ABPOS"].Rows[0];
                    if (dwOrder == null)
                    {
                        IsReturn = true;
                    }
                    KRS = dwOrder["ABPAUFKRS"].ToString().Trim();
                    LFD = dwOrder["ABPAUFLFD"].ToString().Trim();
                    POS = dwOrder["ABPAUFPOS"].ToString().Trim();
                    order = KRS + Helper.GetSubRollNum(LFD) + Helper.GetSubRollNum(POS) + "复板单完成";
                    DestFile = destfolder + "\\" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRABFB";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRABFB(dsSource);
                    break;
                case "YGRABFB":
                    destfolder = SetFolder(Root, "复板单启动");
                    #region====文件命名==============
                    if (!dsSource.Tables.Contains("ABPOS"))
                        IsReturn = true;
                    dwOrder = dsSource.Tables["ABPOS"].Rows[0];
                    if (dwOrder == null)
                    {
                        IsReturn = true;
                    }
                    KRS = dwOrder["ABPAUFKRS"].ToString().Trim();
                    LFD = dwOrder["ABPAUFLFD"].ToString().Trim();
                    POS = dwOrder["ABPAUFPOS"].ToString().Trim();
                    order = KRS + Helper.GetSubRollNum(LFD) + Helper.GetSubRollNum(POS) + "复板单启动";
                    DestFile = destfolder + "\\" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRABFB";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRABFB(dsSource);
                    break;
                case "YGRAB50GB12":
                    destfolder = SetFolder(Root, "领料单");
                    #region====文件命名==============
                    if (!dsSource.Tables.Contains("ABKOPF"))
                        IsReturn = true;
                    dwOrder = dsSource.Tables["ABKOPF"].Rows[0];
                    if (dwOrder == null)
                    {
                        IsReturn = true;
                    }
                    KRS = dwOrder["ABKAUFKRS"].ToString().Trim();
                    LFD = dwOrder["ABKAUFLFD"].ToString().Trim();
                    order = KRS + Helper.GetSubRollNum(LFD);
                    DestFile = destfolder + "\\GB" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRAB50GB20";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRAB50GB12(dsSource);
                    break;
                case "YGRAB50GB20":
                    destfolder = SetFolder(Root, "分磅单");
                    #region====文件命名==============
                    if (!dsSource.Tables.Contains("ABPOS"))
                        IsReturn = true;
                    dwOrder = dsSource.Tables["ABPOS"].Rows[0];
                    if (dwOrder == null)
                    {
                        IsReturn = true;
                    }
                    KRS = dwOrder["ABPAUFKRS"].ToString().Trim();
                    LFD = dwOrder["ABPAUFLFD"].ToString().Trim();
                    POS = dwOrder["ABPAUFPOS"].ToString().Trim();
                    order = KRS + "-" + Helper.GetSubRollNum(LFD) + "-" + Helper.GetSubRollNum(POS);
                    DestFile = destfolder + "\\GB20" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRAB50GB20";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRAB50GB20(dsSource);
                    break;
                case "YGRPDC":
                    destfolder = SetFolder(Root, "作业采集");
                    #region====文件命名==============
                    DestFile = destfolder + "\\作业采集.xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRPDC";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRPDC(dsSource);
                    break;
                case "YGRPDCTOT":
                    destfolder = SetFolder(Root, "作业采集");
                    #region====文件命名==============
                    DestFile = destfolder + "\\作业采集汇总.xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRPDCTOT";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRPDCTOT(dsSource);
                    break;
                case "YGRCPGB20":
                    destfolder = SetFolder(Root, "成纱质量");
                    #region====文件命名==============
                    DestFile = destfolder + "\\成品数量对比.xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRCPGB20";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRCPGB20(dsSource);
                    break;
                case "YGRGB14":
                    destfolder = SetFolder(Root, "成品出入库");
                    #region====文件命名==============
                    DestFile = destfolder + "\\成品出入库汇总.xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRGB14";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRGB14(dsSource);
                    break;
                case "YGRYLGB02":
                    destfolder = SetFolder(Root, "原料库存");
                    #region====文件命名==============
                    DestFile = destfolder + "\\原料库存.xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRYLGB02";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRYLGB02(dsSource);
                    break;
                case "YGRYLGB14":
                    destfolder = SetFolder(Root, "原料出入库");
                    #region====文件命名==============
                    DestFile = destfolder + "\\原料出入库汇总.xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRYLGB14";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRYLGB14(dsSource);
                    break;
                case "YGRQCVV":
                    destfolder = SetFolder(Root, "质检");
                    #region====文件命名==============
                    DestFile = destfolder + "\\纱线质检.xls";
                    #endregion
                    #region=====空白文档=======
                    Standards.Add("YGRQCXS");
                    Standards.Add("YGRQCBX");
                    exAgent.AddNewSheets(temp + ".xls", Standards);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRQCVV(dsSource);
                    break;
                case "YGRQCVVT":
                    destfolder = SetFolder(Root, "质检");
                    #region====文件命名==============
                    if (!dsSource.Tables.Contains("QORDER"))
                        IsReturn = true;
                    dwOrder = dsSource.Tables["QORDER"].Rows[0];
                    if (dwOrder == null)
                    {
                        IsReturn = true;
                    }
                    LFD = dwOrder["GPALIEFSCH"].ToString().Trim();
                    POS = dwOrder["KDNAME"].ToString().Trim();
                    order = Helper.GetGB2312Value(POS) + "-" + Helper.GetSubRollNum(LFD);
                    DestFile = destfolder + "\\" + order + "纱线质检.xls";
                    #endregion
                    #region=====空白文档=======
                    Standards.Add("YGRQCXS");
                    Standards.Add("YGRQCBX");
                    exAgent.AddNewSheets(temp + ".xls", Standards);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRQCVV(dsSource);
                    break;
                case "YGRQCXS":
                    destfolder = SetFolder(Root, "质检");
                    #region====文件命名==============
                    DestFile = destfolder + "\\细纱质检.xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRQCXS";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRQCXS(dsSource);
                    break;
                case "YGRQCBX":
                    destfolder = SetFolder(Root, "质检");
                    #region====文件命名==============
                    DestFile = destfolder + "\\股线质检.xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRQCBX";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRQCBX(dsSource);
                    break;
                case "YGRQCYM":
                    destfolder = SetFolder(Root, "质检");
                    #region====文件命名==============
                    DestFile = destfolder + "\\原棉质检.xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRQCYM";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRQCYM(dsSource);
                    break;
                case "YGRQCSM":
                    destfolder = SetFolder(Root, "质检");
                    #region====文件命名==============
                    DestFile = destfolder + "\\色棉质检.xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRQCSM";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRQCSM(dsSource);
                    break;
                case "YGRYLGBMOV":
                    destfolder = SetFolder(Root, "仓库");
                    #region====文件命名==============
                    DestFile = destfolder + "\\原料进销存" + STARTD + "-" + ENDD + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRYLGBMOV";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRYLGBMOV(dsSource, STARTD, ENDD);
                    break;
                case "YGRCPGBMOV":
                    destfolder = SetFolder(Root, "仓库");
                    #region====文件命名==============
                    DestFile = destfolder + "\\成品进销存" + STARTD + "-" + ENDD + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRCPGBMOV";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRCPGBMOV(dsSource, STARTD, ENDD);
                    break;
                #endregion

                case "YGREKDOC":
                    destfolder = SetFolder(Root, "采购单");
                    #region====文件命名==============
                    if (!dsSource.Tables.Contains("EKKOPF"))
                        IsReturn = true;
                    dwOrder = dsSource.Tables["EKKOPF"].Rows[0];
                    if (dwOrder == null)
                    {
                        IsReturn = true;
                    }
                    KRS = dwOrder["EKKAUFKRS"].ToString().Trim();
                    LFD = dwOrder["EKKAUFLFD"].ToString().Trim();
                    order = KRS + Helper.GetSubRollNum(LFD);
                    DestFile = destfolder + "\\EK" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGREKDOC";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGREKDOC();
                    break;

                case "YGRXJSH":
                    destfolder = SetFolder(Root, "XJ色号清单");
                    #region====文件命名=============da=
                    order = date;
                    DestFile = destfolder + "\\XJ色号清单" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRXJSH";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRXJSH(dsSource);
                    break;
                case "YGRVVVK":
                    destfolder = SetFolder(Root, "合同");
                    #region====文件命名==============
                    dwOrder = dsSource.Tables["VVLIEF"].Rows[0];
                    order = Helper.GetSubRollNum(dwOrder["VVLIEFSCH"].ToString());
                    DestFile = destfolder + "\\VK" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRVVVK";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRVVVK();
                    break;
                case "YGRVKPOS":
                    destfolder = SetFolder(Root, "合同");
                    #region====文件命名==============
                    dwOrder = dsSource.Tables["VKKOPF"].Rows[0];
                    KRS = dsSource.Tables["VKPOS"].Rows[0]["VKPAUFKRS"].ToString().Trim();
                    LFD = dsSource.Tables["VKPOS"].Rows[0]["VKPAUFLFD"].ToString().Trim();
                    order = KRS + "-" + Helper.GetSubRollNum(LFD);
                    DestFile = destfolder + "\\VK" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRVKPOS";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRVKPOS();
                    break;
                case "YGRVKKDEK":
                    destfolder = SetFolder(Root, "合同");//最终文件目录
                    #region====文件命名==============
                    dwOrder = dsSource.Tables["VKKOPF"].Rows[0];
                    KRS = dsSource.Tables["VKPOS"].Rows[0]["VKPAUFKRS"].ToString().Trim();
                    LFD = dsSource.Tables["VKPOS"].Rows[0]["VKPAUFLFD"].ToString().Trim();
                    order = KRS + "-" + Helper.GetSubRollNum(LFD);
                    DestFile = destfolder + "\\CG" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRVKKDEK";//模板
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRVKKDEK();//写入数据
                    break;
                case "YGRVKEX":
                    destfolder = SetFolder(Root, "合同");
                    #region====文件命名==============
                    dwOrder = dsSource.Tables["VKKOPF"].Rows[0];
                    KRS = dsSource.Tables["VKPOS"].Rows[0]["VKPAUFKRS"].ToString().Trim();
                    LFD = dsSource.Tables["VKPOS"].Rows[0]["VKPAUFLFD"].ToString().Trim();
                    order = KRS + "-" + Helper.GetSubRollNum(LFD);
                    DestFile = destfolder + "\\HT" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRVKEX";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRVKEX();
                    break;
                case "YGRVKEXVT"://外销采购合同
                    destfolder = SetFolder(Root, "合同");
                    #region====文件命名==============
                    dwOrder = dsSource.Tables["VKKOPF"].Rows[0];
                    KRS = dsSource.Tables["VKPOS"].Rows[0]["VKPAUFKRS"].ToString().Trim();
                    LFD = dsSource.Tables["VKPOS"].Rows[0]["VKPAUFLFD"].ToString().Trim();
                    order = KRS + "-" + Helper.GetSubRollNum(LFD);
                    DestFile = destfolder + "\\EX" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRVKEXVT";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRVKEXVT();
                    break;
                case "YGRLABDIPAPP"://花灰纱Lab-Dip申请表
                    destfolder = SetFolder(Root, "LabDip");
                    #region====文件命名==============
                    dwOrder = dsSource.Tables["VKKOPF"].Rows[0];
                    KRS = dsSource.Tables["VKPOS"].Rows[0]["VKPAUFKRS"].ToString().Trim();
                    LFD = dsSource.Tables["VKPOS"].Rows[0]["VKPAUFLFD"].ToString().Trim();
                    order = KRS + "-" + Helper.GetSubRollNum(LFD);
                    DestFile = destfolder + "\\LD" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRLABDIPAPP";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRLABDIPAPP();
                    break;
                case "YGRPAYMENTAPP"://付款申请
                    destfolder = SetFolder(Root, "付款申请");
                    #region====文件命名==============
                    dwOrder = dsSource.Tables["VKKOPF"].Rows[0];
                    KRS = dsSource.Tables["VKPOS"].Rows[0]["VKPAUFKRS"].ToString().Trim();
                    LFD = dsSource.Tables["VKPOS"].Rows[0]["VKPAUFLFD"].ToString().Trim();
                    order = KRS + "-" + Helper.GetSubRollNum(LFD);
                    DestFile = destfolder + "\\PM" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRPAYMENTAPP";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRPAYMENTAPP();
                    break;
                case "YGRPPOLIST"://订单列表
                    destfolder = SetFolder(Root, "订单列表");
                    #region====文件命名==============
                    order = date;
                    DestFile = destfolder + "\\订单列表" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRPPOLIST";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRPPOLIST(dsSource);
                    break;
                case "YGRGS08"://订单列表
                    destfolder = SetFolder(Root, "GS08");
                    #region====文件命名==============
                    order = date;
                    DestFile = destfolder + "\\GS08-" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRGS08DOC";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRGS08(dsSource);
                    break;
                case "YGRVK13LIST"://报价列表
                    destfolder = SetFolder(Root, "报价列表");
                    #region====文件命名==============
                    order = date;
                    DestFile = destfolder + "\\报价列表" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRVK13LIST";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRVK13LIST(dsSource);
                    break;
                case "YGRVV05LIST"://发货计划 
                    destfolder = SetFolder(Root, "发货计划");
                    #region====文件命名==============
                    order = date;
                    DestFile = destfolder + "\\发货计划" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRVV05LIST";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRVV05LIST(dsSource);
                    break;
                case "YGRVV20LIST"://进出口部 
                    destfolder = SetFolder(Root, "进出口部");
                    #region====文件命名==============
                    DataRow dwKD = null;
                    string KDN = "";
                    if (dsSource.Tables["VVLIEF"].Rows.Count == 0)
                        break;
                    if (dsSource.Tables["KDSTAMM"].Rows.Count > 0)
                    {
                        dwKD = dsSource.Tables["KDSTAMM"].Rows[0];
                        KDN = Helper.GetGB2312Value(dwKD["KDKNAME"].ToString()).Trim();//文件名是否不能有空格
                    }
                    dwOrder = dsSource.Tables["VVLIEF"].Rows[0];
                    order = Helper.GetSubRollNum(dwOrder["VVLIEFSCH"].ToString());
                    DestFile = destfolder + "\\运输单-" + order + "-" + KDN + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standards.Add("YGRVV20LIST");
                    Standards.Add("YGRVV20LISTV");
                    exAgent.AddNewSheets(temp + ".xls", Standards);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRVV20LIST(dsSource);
                    break;
                case "YGRVR02LIST"://应收款 YGRVK13LIST YGRVV05LIST YGRVR02LIST
                    destfolder = SetFolder(Root, "应收款");
                    #region====文件命名==============
                    order = date;
                    DestFile = destfolder + "\\应收款" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRVR02LIST";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRVR02LIST(dsSource);
                    break;
                case "YGRGBDAILY"://成品仓库 
                    destfolder = SetFolder(Root, "成品仓库");
                    #region====文件命名==============
                    order = date;
                    DestFile = destfolder + "\\成品仓库" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRGBDAILY";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRGBDAILY(dsSource);
                    break;
                case "YGRGBMOTHLY"://仓库月报
                    destfolder = SetFolder(Root, "仓库月报");
                    #region====文件命名==============
                    order = date;
                    DestFile = destfolder + "\\仓库月报" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRGBMOTHLY";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRGBMOTHLY(dsSource);
                    break;
                case "YGRGBCP"://成品仓库 
                    destfolder = SetFolder(Root, "成品仓库");
                    #region====文件命名==============
                    order = date;
                    DestFile = destfolder + "\\成品仓库" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRGBCP";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRGBCP(dsSource);
                    break;
                case "YGRVKOTD"://OTD 
                    destfolder = SetFolder(Root, "统计");
                    #region====文件命名==============
                    order = date;
                    DestFile = destfolder + "\\OTD统计" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRVKOTD";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRVKOTD(dsSource);
                    break;
                case "YGRVR02KD"://客户应收款 YGRVK13LIST YGRVV05LIST YGRVR02LIST YGRGBDAILY YGRVKOTD YGRVR02KD
                    destfolder = SetFolder(Root, "统计");
                    #region====文件命名==============
                    order = date;
                    DestFile = destfolder + "\\客户应收款" + order + ".xls";
                    #endregion
                    #region=====空白文档=======
                    Standard = "YGRVR02KD";
                    exAgent.CreateNewSheet(temp + ".xls", Standard);
                    tempfile = exAgent.FileName;
                    #endregion
                    YGRVR02KD(dsSource);
                    break;

            }
            return filename;
        }


    }
}
